export default {
  cover: [{ required: true, message: "请输入封面图片", trigger: "blur" }],
  newsTitle: [{ required: true, message: "请输入新闻标题", trigger: "blur" }],
  newsDiscription: [
    { required: true, message: "请输入新闻说明", trigger: "blur" },
  ],
  content: [
    { required: true, message: "请输入新闻内容", trigger: "blur" },
    {
      validator: (rule, value, callback) => {
        const cleanedContent = value.replace(/<(?!img|video)[^>]*>/g, '').trim();
        if (cleanedContent === "") {
          callback(new Error("新闻内容不能为空"));
          console.log("Editor is empty");
        } else {
          callback();
        }
      },
      trigger: ["blur", "change"],
    },
  ],
  enabled: [
    { required: true, message: "是否启用", trigger: "blur" },
  ],
};
